import { request } from '@umijs/max';

export async function getResourceGroupList(params: any, options?: { [key: string]: any }) {
  return request<API.Data>('/corpus/resource/getResourceGroupList', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function getGovernanceResourceGroupList(
  params: any,
  options?: { [key: string]: any },
) {
  return request<API.Data>('/corpus/governanceCorpus/getResourceGroupList', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function deleteResourceGroup(id: string | number, options?: { [key: string]: any }) {
  return request<API.DeptType>(`/corpus/resource/deleteResourceGroup?id=${id}`, {
    method: 'get',

    ...(options || {}),
  });
}
export async function deleteGovernanceResourceGroup(
  id: string | number,
  options?: { [key: string]: any },
) {
  return request<API.DeptType>(`/corpus/governanceCorpus/deleteResourceGroup?id=${id}`, {
    method: 'get',

    ...(options || {}),
  });
}

export async function addResourceGroup(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/resource/addResourceGroup', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function uploadCorpusFile(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/corpusFile/uploadCorpusFile', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function addGovernanceResourceGroup(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/governanceCorpus/addResourceGroup', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function editResourceGroup(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/resource/editResourceGroup', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function editGovernanceResourceGroup(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/governanceCorpus/editResourceGroup', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function getResourceFile(params: any, options?: { [key: string]: any }) {
  return request<API.Data>('/corpus/resource/getResourceFile', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function getGovernanceResourceFile(params: any, options?: { [key: string]: any }) {
  return request<API.Data>('/corpus/governanceCorpus/getResourceFile', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function getCorpusFileData(params: any, options?: { [key: string]: any }) {
  return request<API.Data>('/corpus/corpusFile/getCorpusFile', {
    method: 'post',
    data: params,

    ...(options || {}),
  });
}

export async function deleteResourceFile(
  data: { ids: string[] | number[] },
  options?: { [key: string]: any },
) {
  return request<API.Data>(`/corpus/resource/deleteResourceFile`, {
    method: 'post',
    data,
    ...(options || {}),
  });
}

export async function deleteGovernanceResourceFile(
  data: { ids: string[] | number[] },
  options?: { [key: string]: any },
) {
  return request<API.Data>(`/corpus/governanceCorpus/deleteResourceFile`, {
    method: 'post',
    data,
    ...(options || {}),
  });
}

export async function getCatalog(params: any, options?: { [key: string]: any }) {
  return request<API.Data>('/corpus/catalog/knowledege/page', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function getDetail(data: any, options?: { [key: string]: any }) {
  return request<API.DeptType>(`/corpus/catalog/knowledege/detail`, {
    method: 'post',
    data,
    ...(options || {}),
  });
}
export async function addResourceFile(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/resource/addResourceFile', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function addGovernanceResourceFile(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/governanceCorpus/addResourceFile', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function addResourceFileKnowledge(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/knowledgeFile/addResourceFile', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function addFileByCorpus(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/knowledgeFile/addFileByCorpus', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function parseBatch(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/resource/parseBatch', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function getNewList(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/knowledge/getNewList', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function getGovernanceNewList(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/governanceCorpus/getNewList', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function addNewKnowledge(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/knowledge/addNewKnowledge', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function addGovernanceNewKnowledge(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/governanceCorpus/addNewKnowledge', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function getFilePage(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/opentrek-konwledge/file-page', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function getFileTaskPage(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/opentrek-konwledge/file-task-detail', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function priveiwUrl(id: any, options?: { [key: string]: any }) {
  return request<{ data: any[] }>(`/corpus/resource/downloadFile?id=${id}`, {
    method: 'get',
    ...(options || {}),
    responseType: 'blob',
  });
}

export async function priveiwCommUrl(id: any, options?: { [key: string]: any }) {
  return request<{ data: any[] }>(`/corpus/common/downloadFile?fileId=${id}`, {
    method: 'get',
    ...(options || {}),
    responseType: 'blob',
  });
}

export async function getResource(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/resource/index', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function getGovernanceResource(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/governanceCorpus/index', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function getCorpusBaseList(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/corpusBase/getCorpusBaseList', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function getGovernanceCorpusBaseList(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/governanceCorpus/getCorpusBaseList', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function addCorpusBase(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/corpusBase/addCorpusBase', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function addGovernanceCorpusBase(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/governanceCorpus/addCorpusBase', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function editCorpusBase(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/corpusBase/editCorpusBase', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function editGovernanceCorpusBase(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/governanceCorpus/editCorpusBase', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function corpusFileTaskBrief(id: any, options?: { [key: string]: any }) {
  return request<any>(`/corpus/corpusFile/corpusFileTaskBrief?corpusId=${id}`, {
    method: 'get',
    ...(options || {}),
  });
}
export async function saveFileByCorpus(data: any, options?: { [key: string]: any }) {
  return request<any>(`/corpus/knowledgeFile/saveFileByCorpus`, {
    method: 'post',
    data,
    ...(options || {}),
  });
}
export async function saveFileByCorpusData(data: any, options?: { [key: string]: any }) {
  return request<any>(`/corpus/corpusFile/saveFileByCorpus`, {
    method: 'post',
    data,
    ...(options || {}),
  });
}

export async function retryCorpusFileTask(id: any, options?: { [key: string]: any }) {
  return request<any>(`/corpus/corpusFile/retryCorpusFileTask?taskId=${id}`, {
    method: 'post',
    ...(options || {}),
  });
}
export async function deleteCorpusBase(params: any, options?: { [key: string]: any }) {
  return request<any>(`/corpus/corpusBase/deleteCorpusBase?id=${params}`, {
    method: 'get',

    ...(options || {}),
  });
}
export async function deleteGovernanceCorpusBase(params: any, options?: { [key: string]: any }) {
  return request<any>(`/corpus/governanceCorpus/deleteCorpusBase?id=${params}`, {
    method: 'get',

    ...(options || {}),
  });
}

export async function getCorpusFileList(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/corpusFile/getCorpusFileList', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function getGovernanceCorpusFileList(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/governanceCorpus/getCorpusFileList', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}
export async function deleteCorpusFile(id: any, options?: { [key: string]: any }) {
  return request<API.Data>(`/corpus/corpusFile/deleteCorpusFile?id=${id}`, {
    method: 'get',
    ...(options || {}),
  });
}
export async function deleteGovernanceCorpusFile(id: any, options?: { [key: string]: any }) {
  return request<API.Data>(`/corpus/governanceCorpus/deleteCorpusFile?id=${id}`, {
    method: 'get',
    ...(options || {}),
  });
}

export async function addCorpusFile(params: any, options?: { [key: string]: any }) {
  return request<any>('/corpus/corpusFile/addCorpusFile', {
    method: 'POST',
    data: params,

    ...(options || {}),
  });
}

export async function getPrompt(type: any, options?: { [key: string]: any }) {
  return request<any>(`/corpus/corpusFile/getPrompt?type=${type}`, {
    method: 'get',

    ...(options || {}),
  });
}

export async function getCorpusFileTask(params: any, options?: { [key: string]: any }) {
  return request<any>(`/corpus/corpusFile/getCorpusFileTask`, {
    method: 'get',
    params,
    ...(options || {}),
  });
}
export async function getGovernanceCorpusFileTask(params: any, options?: { [key: string]: any }) {
  return request<any>(`/corpus/governanceCorpus/getCorpusFileTask`, {
    method: 'get',
    params,
    ...(options || {}),
  });
}

export async function getKnowledgeChunk(params: any, options?: { [key: string]: any }) {
  return request<any>(`/corpus/opentrek-konwledge/chunk-list`, {
    method: 'post',
    data: params,
    ...(options || {}),
  });
}
